from PIL import Image

filename = "flower.jpg"
times = 2

im = Image.open(filename)
im.thumbnail(tuple(sz//times for sz in im.size))
im.save("thumbnail.jpg")
